﻿/* PROJECT ETERNAL - SOURCE CODE
 * RELEASED UNDER GNU GPL v3
 * 
 * A STUDENT WRITTEN OPEN SOURCE SIDE SCROLLING VIDEO GAME
 * 
 */

//CHANGE LOG
/* 2.20.12 - ADDED CLASS - RUNS - BACON
 * 
 */

/*
 * 
 * 
 */

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.Graphics;

namespace ETERNAL
{
    class Level
    {
        public Tile[] tiles = new Tile[2];
        public Player player;
        public List<DrawableObject> drawableObjects = new List<DrawableObject>();

        public Level()
        {
            player = new Player();
            for (int i = 0; i < 2; i++)
            {
                tiles[i] = new Tile();
            }
            drawableObjects.Add(player);
        }

        public void LoadContent(ContentManager cM)
        {
            foreach (DrawableObject dObject in drawableObjects)
            {
                dObject.LoadContent(cM);
            }
        }

        public void Update()
        {
            foreach (DrawableObject dObject in drawableObjects)
            {
                dObject.UpdateObject();
            }
        }

        public void DrawLevel(SpriteBatch spriteBatch)
        {
            foreach (Tile tile in tiles)
            {
                tile.DrawTile();
            }
            foreach (DrawableObject dObject in drawableObjects)
            {
                dObject.DrawObject(spriteBatch);
            }
        }
    }
}
